<html>
<head><meta charset="utf-8"><title>script to quickly generate complete git worktree · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/script.20to.20quickly.20generate.20complete.20git.20worktree.html">script to quickly generate complete git worktree</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="210346855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/script%20to%20quickly%20generate%20complete%20git%20worktree/near/210346855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lzutao <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/script.20to.20quickly.20generate.20complete.20git.20worktree.html#210346855">(Sep 17 2020 at 04:20)</a>:</h4>
<p>The completion here is that I don't need to wait 10 minutes to fetch submodules.<br>
It could fetch from local submodules and change the submodule URL back to original.<br>
cc <span class="user-mention" data-user-id="232545">@Joshua Nelson</span> if you could have some inputs.</p>



<a name="210673428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/script%20to%20quickly%20generate%20complete%20git%20worktree/near/210673428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lzutao <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/script.20to.20quickly.20generate.20complete.20git.20worktree.html#210673428">(Sep 20 2020 at 16:18)</a>:</h4>
<p>after adding worktree, don't run x.py but change config.toml and disallow auto-update submodule config.<br>
Then manually run <code>git submodule init</code> and <code>git submodule update &lt;needed modules like backtrace&gt;</code>.</p>



<a name="210673556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/script%20to%20quickly%20generate%20complete%20git%20worktree/near/210673556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/script.20to.20quickly.20generate.20complete.20git.20worktree.html#210673556">(Sep 20 2020 at 16:22)</a>:</h4>
<p>I think <code>x.py --help</code> will do this</p>



<a name="210673680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/script%20to%20quickly%20generate%20complete%20git%20worktree/near/210673680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lzutao <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/script.20to.20quickly.20generate.20complete.20git.20worktree.html#210673680">(Sep 20 2020 at 16:24)</a>:</h4>
<p>x.py unconditionally initing and updating all submodule, even with --help flag.</p>



<a name="210673689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/script%20to%20quickly%20generate%20complete%20git%20worktree/near/210673689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/script.20to.20quickly.20generate.20complete.20git.20worktree.html#210673689">(Sep 20 2020 at 16:25)</a>:</h4>
<p>I don't understand what your question is then</p>



<a name="210673692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/script%20to%20quickly%20generate%20complete%20git%20worktree/near/210673692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/script.20to.20quickly.20generate.20complete.20git.20worktree.html#210673692">(Sep 20 2020 at 16:25)</a>:</h4>
<p>what are you trying to do?</p>



<a name="210673710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/script%20to%20quickly%20generate%20complete%20git%20worktree/near/210673710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lzutao <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/script.20to.20quickly.20generate.20complete.20git.20worktree.html#210673710">(Sep 20 2020 at 16:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="209117">lzutao</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/script.20to.20quickly.20generate.20complete.20git.20worktree/near/210673428">said</a>:</p>
<blockquote>
<p>after adding worktree, don't run x.py but change config.toml and disallow auto-update submodule config.<br>
The manually <code>git submodule init</code> and <code>git submodule update &lt;needed modules like backtrace&gt;</code>.</p>
</blockquote>
<p>This isn't a question, just a tip for later readers.</p>



<a name="210702542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/script%20to%20quickly%20generate%20complete%20git%20worktree/near/210702542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> teor <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/script.20to.20quickly.20generate.20complete.20git.20worktree.html#210702542">(Sep 21 2020 at 05:23)</a>:</h4>
<p>Git has some options that let you clone from a remote, but copy refs from a local repository.</p>
<p>Do submodules have similar options?</p>
<p>If not, you might be able to do a shallow clone, add the local as a ref, fetch from the ref, then do a deep clone.</p>



<a name="212063218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/script%20to%20quickly%20generate%20complete%20git%20worktree/near/212063218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lzutao <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/script.20to.20quickly.20generate.20complete.20git.20worktree.html#212063218">(Oct 02 2020 at 11:44)</a>:</h4>
<p>I came up with a script: <a href="https://gist.github.com/lzutao/a09855fe25a36bcd81cc3227d6e6fac7#file-setup-rustc-worktree-bash">https://gist.github.com/lzutao/a09855fe25a36bcd81cc3227d6e6fac7#file-setup-rustc-worktree-bash</a><br>
It requires a deep clone of rustc and all submodules initialized and updated.<br>
but it really fast to run to fast initialize all modules in new git worktree.<br>
after running, new worktree will have about 1.3G.<br>
Root (normal) rust repo is about 5G.<br>
the disadvantage is that the disk space, although I try to use hard-link copying.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>